<include file="public@header"/>
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('result/index')}">所有成绩</a></li>
        <li><a href="{:url('result/add')}">成绩记录</a></li>
    </ul>
    <form class=" well form-inline margin-top-20" action="{:url('result/index')}" method="get">
        成绩名称:
        <input type="text" name="name" class="form-control" style="" value="{$Request.param.name}">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('result/index')}">清空</a>
    </form>
    <form class=" well form-inline margin-top-20" method="get">
        <a class="btn btn-primary" href="{:url('result/exportExcel')}">导出Excel</a>
        <a class="btn btn-danger" id="import">导入Excel</a>
        <a class="btn btn-primary" href="{:url('result/download')}" style="background-color: green;color:white; width: 120px;">下载Excel模板</a>
    </form>
        <table class="table table-hover table-bordered table-list">
            <thead>
            <tr>
                <th width="50">ID</th>
                <th>学生姓名</th>
                <th>学生科目</th>
                <th>成绩</th>
                <th width="160">{:lang('ACTIONS')}</th>
            </tr>
            </thead>
            <foreach name="result" item="vo">
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.student_name}</td>
                    <td>{$vo.subject_name}</td>
                    <td>{$vo.result}</td>
                    <td>
                        <a class="btn btn-xs btn-primary" href="{:url('result/edit',array('id'=>$vo['id']))}">编辑</a>
                        <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('result/delete',array('id'=>$vo['id']))}">删除</a>
                    </td>
                </tr>
            </foreach>
        </table>
    <div class="pagination">{$page}</div>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/layui/layui.all.js"></script>
<script>
    layui.use('upload',function () {
        var upload=layui.upload;
        var uploadInst=upload.render({
            elem:'#import',
            url:"{:url('result/importExcel')}",
            accept:'file',
            done:function (res) {
                layer.msg('成功导入'+res.success+'条数据');
                setTimeout(function () {
                    location.reload();
                },2000)
            }
        })
    })
</script>
</body>
</html>